package com.yqy.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
//@RequestMapping("/test")
//此时控制器方法所匹配的请求路径为/test/hello
public class RequestMappingTestController {
    @RequestMapping(
            value = {"/hello","/test"},
            method = {RequestMethod.POST,RequestMethod.GET},
            params = {"sign","username=root","!password","token!=md5"},
            headers = {"Referer!=http://localhost:8080/SpringMVC/"}
    )
    public String testRequestMapping(){
        return "success";
    }

    @RequestMapping("/**/ant")
    public String testAnt(){
        return "success";
    }

    @RequestMapping("/rest/{username}/{password}")
    public String testRest(@PathVariable String username, @PathVariable String password){
        System.out.println("用户名："+username+"\n密码："+password);
        return "success";
    }
    
}
